from app.models.taobao_orders import taobao_orders
from app.validators.base import BaseForm as Form
from wtforms import StringField, ValidationError


class OrderForm(Form):
    order_number = StringField(default='')


class BanOrderForm(Form):
    order_number = StringField(default='')

    def validate_order_number(self, field):
        tb_info = taobao_orders.query.filter_by(order_number=field.data).first()
        if not tb_info:
            return ValidationError('')
